Redis and Magento – More than Meets the Eye
Next up in our We Host Magento Better! series is a look at how we leverage Redis to make Magento faster and scale better with size. There’s more to it than just turning it on and letting it run…
What is Redis?
The Redis website defines it as:
Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.
Put simply, Redis allows you to store data like sessions, cache files, etc… in memory efficiently, so it can be accessed quickly and with very little overhead. Combined with Magento, it can help not only make things faster (memory is faster than a disk lookup for a file, and it’s indexed more efficiently), but it can scale better for larger sites with lots of visitors or lots of products.
As long as you have enough available memory, Redis is a win-win.
Are there settings to make Redis perform optimally?
Out of the box, Redis is not optimized for use with Magento. There are a number of settings and configurations that have to be set for the best speed, reliability, and to minimize resource usage. Many web hosts just turn it on and say “you’re all set”. This is a recipe for disaster…
Things we at LexiConn do to optimize Redis are:
- Proper memory limits for each Redis instance to ensure the caches do not fill up and cause issues.
- Using separate Redis installs / instances to avoid any limitations due to Redis being a single-threaded application
- Proper saving of data to disk as a backup, which includes not saving cache related data to a file. This is huge in terms of efficiency and limiting I/O problems as the databases grow over time
- Setting up garbage collection in Redis to get rid of expired and stale data
Monitoring and adjusting Redis is needed for long term stability
Many people think Redis is a “set-it-and-forget-it” installation. Just set it up, and let it do its thing. Unfortunately, this can lead to major issues and problems if not properly monitored and adjusted.
Some hosts may do a simple “is Redis running” check periodically. They may use the “ping-pong” test to make sure Redis is alive. We do this, but we take it a step further.
For each Redis environment, we monitor each Redis install to make sure it is not nearing max memory usage. If it is, we’re alerted to this fact, and can adjust the memory settings on the fly, recommend adding more RAM to the server / account, or investigate why the memory usage is so high.
If your web host does not do this, and Redis becomes maxed out in its memory setting, this can cause cache corruption, sessions being dropped, and can break the site entirely. We’ve actually moved a few Magento sites where Redis was not set up properly and led to issues with 500 errors and odd problems with the functionality of the website.
…
Redis is a great way to help improve performance and scalability for a Magento store. However, if improperly configured, or poorly monitored, this can lead to more problems down the road, and actually cause a degradation in performance.
Looking for a web host that understands ecommerce and business hosting?
Check us out today!